package com.learn.temp.api;

import java.util.HashMap;

/**
 * @author wangxing
 * @version 2020/6/10 23:39 Administrator
 */
public class TestDynamicLoad {
    static {
        System.out.println("--------load TestDynamicLoad");
    }

    public static void main(String[] args) {
        new A();
        HashMap h = new HashMap(1);
        System.out.println(Son.a);
        System.out.println("==============================");
        System.out.println(Son1.a);
        System.out.println("==============================");
        System.out.println(Son2.a);
        System.out.println("==============================");
    }
}

class A {
    static {
        System.out.println("----------load A");
    }

    public A() {
        System.out.println("----------- new A");
        B b = null;
    }
}

class B {
    static {
        System.out.println("-------------load B");
    }

    public B() {
        System.out.println("----------- new B");
    }
}

class Parent {
    static String a = "parent";

    static {
        System.out.println("-----------load Parent");
    }
}

class Son extends Parent {
    static {
        System.out.println("------------load Son");
    }
}

class Son1 extends Parent {
    static String a = "son1";

    static {
        System.out.println("------------load Son1");
    }
}

class Parent2 {
    static final String a = "parent2";

    static {
        System.out.println("-----------load parent2");
    }
}

class Son2 extends Parent2 {
    static {
        System.out.println("-----------load Son2");
    }
}
